package ajk;

import static org.junit.Assert.assertEquals;
import org.junit.Test;

/**
 * Tests that WallSpin fires bullets with power proportional to the enemy's distance.
 * 
 * @author Philip Johnson
 * 
 */
public class TestWallSpinWallFirePower {
  /** create an instance of the wallspin robot. **/
  WallSpin myRobot = new WallSpin();

  /**
   * Tests to see that WallSpins firePower function returns the correct firePower given a specific
   * enemy distance and maxDistance.
   */
  @Test
  public void run() {
    int maxDistance = 500;
    assertEquals("Check 100% Distance", myRobot.firePower(maxDistance, maxDistance), 0.1, 0.001);
    assertEquals("Check 70% Distance", myRobot.firePower(maxDistance, maxDistance * 0.70), 0.5,
        0.001);
    assertEquals("Check 55% Distance", myRobot.firePower(maxDistance, maxDistance * 0.55), 1.0,
        0.001);
    assertEquals("Check 40% Distance", myRobot.firePower(maxDistance, maxDistance * 0.40), 1.5,
        0.001);
    assertEquals("Check 25% Distance", myRobot.firePower(maxDistance, maxDistance * 0.25), 2.0,
        0.001);
    assertEquals("Check 10% Distance", myRobot.firePower(maxDistance, maxDistance * 0.10), 2.5,
        0.001);
    assertEquals("Check 0% Distance", myRobot.firePower(maxDistance, 0), 3.0, 0.001);

  }

}
